/* $RCSFile: ADNDynDocumentindex.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynDocumentindex.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynDocumentindex */
/* Date 2010-01-06 16:07:42Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    /// <summary>
    /// Related to salesliteratureitem
    /// </summary>
    public class ADNDynDocumentindex : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.documentindex)
            {}

            public override Type DynType
            { get { return typeof(ADNDynDocumentindex); } }

            public override string DynTypename
            {   get{ return CrmStr.documentindex;}}

            public override DynEntity Build()
            {   return new ADNDynDocumentindex();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynDocumentindex(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynDocumentindex(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynDocumentindex(w,PrimaryKeyValue);}
        }

        static ADNDynDocumentindex(){new Ftor();} 
        
        public override bool HasOwnerProperty
        {
            get { return false; }
        }
        
        public ADNDynDocumentindex() : base() { }
        
        public ADNDynDocumentindex(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.documentindex)
        {
            if ( PrimaryFieldValue != string.Empty )
                title = PrimaryFieldValue;
        }
        
        public ADNDynDocumentindex(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.documentindex,CrmId) { }
        
        public ADNDynDocumentindex(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.documentindex,e,null,null) { }
        
        public ADNDynDocumentindex(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.documentindex,e,prop,s) { }
        
        public ADNDynDocumentindex(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.documentindex)
        {
            if ( PrimaryFieldValue != string.Empty )
                title = PrimaryFieldValue;
        }
        
        public ADNDynDocumentindex(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.documentindex,CrmId) { }
        
        public ADNDynDocumentindex(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.documentindex,e,null,null) { }
        
        public ADNDynDocumentindex(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.documentindex,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.documentindex)]
        public Guid documentindexid
        {
            get
            { return KeyPropertyValue(CrmStr.documentindexid); }
            set
            { AddKeyProperty(CrmStr.documentindexid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.documentindexid) || KeyPropertyValue(CrmStr.documentindexid) != crmId )
                documentindexid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return documentindexid; }
            set { documentindexid = value; }
        }
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.title; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return title;
            }
            set
            {
                title =   value;
            }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public Guid documentid
        {
            get
            { return LookupPropertyValue(CrmStr.documentid); }
            set
            { AddLookupProperty(CrmStr.documentid,CrmStr.salesliteratureitem,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public int documenttypecode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.documenttypecode); }
            set
            { AddPicklistProperty(CrmStr.documenttypecode,value); }
        }

        public string documenttypecodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.documenttypecode); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public bool ispublished
        {
            get
            { return BooleanPropertyValue(CrmStr.ispublished); }
            set
            { AddBooleanProperty(CrmStr.ispublished,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public string keywords
        {
            get
            { return StringPropertyValue(CrmStr.keywords); }
            set
            { AddStringProperty(CrmStr.keywords,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public string location
        {
            get
            { return StringPropertyValue(CrmStr.location); }
            set
            { AddStringProperty(CrmStr.location,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public string number
        {
            get
            { return StringPropertyValue(CrmStr.number); }
            set
            { AddStringProperty(CrmStr.number,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public override Guid organizationid
        {
            get
            { return LookupPropertyValue(CrmStr.organizationid); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public string searchtext
        {
            get
            { return StringPropertyValue(CrmStr.searchtext); }
            set
            { AddStringProperty(CrmStr.searchtext,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public Guid subjectid
        {
            get
            { return LookupPropertyValue(CrmStr.subjectid); }
            set
            { AddLookupProperty(CrmStr.subjectid,CrmStr.subject,value); }
        }

        [CrmDynAttribute(CrmStr.documentindex)]
        public string title
        {
            get
            { return StringPropertyValue(CrmStr.title); }
            set
            { AddStringProperty(CrmStr.title,value); }
        }
    }
}